package puzzle.projecteuler.p100;

/**
 * for T(2n-1) = H(n), so we can only search for Hn = Pm
 * @author Administrator
 *
 */
public class Problem045 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		int count = 0;
		for (long n = 1; ; n ++) {
			long h = n*(2*n-1);
			long t = (long)((Math.floor(Math.sqrt(24*h+1))+1)/6.0);
			if (h == t*(3*t-1)/2) {
				count ++;
				if (count < 4) {
					System.out.println(h);
				} else {
					break;
				}
			}
		}
	}
}
